use criterion::{black_box, criterion_group, criterion_main, Criterion};
use e_utils::system::regex::regex2;

fn benchmark_regex2(c: &mut Criterion) {
  let inputs = [
        ("test\nC:/test/example.txt\n更多测试1", "*.txt"),
        ("AMI Desktop Management Interface Edit Utility v5.27.02.0006        |\r\n|      Copyright (c) 1985-2021, American Megatrends International LLC.      |\r\n|         All rights reserved. Subject to AMI licensing agreement.          |\r\n+---------------------------------------------------------------------------+\r\n\r\nInitializing the SMBIOS interface.  Please wait a moment......\r\n          Name              R/W  Status  Information\r\r\n--------------------------  ---  ------  ----------------------------------\r\r\n(/BS)Baseboard Serial number W    Done   \"123\"...", "(/BS)Baseboard Serial number W    Done   \"*\"..."),
        ("no_match", "*.txt"),
        ("test\nC:/test/example.txt\n更多测试2\n12", "test/*.txt*"),
    ];

  c.bench_function("regex2 various inputs", |b| {
    b.iter(|| {
      for (input, pattern) in &inputs {
        println!("{input}");
        black_box(regex2(black_box(input), black_box(pattern)));
      }
    })
  });
}

criterion_group!(benches, benchmark_regex2);
criterion_main!(benches);
